
<%@ page import="java.util.Map" %>
<%@ page import="com.luntan.school.model.Comment" %>
import com.cdvtc.news.model.Comment;
import com.cdvtc.news.util.TimeFormat;

import java.util.Map;
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zhao
  Date: 2021/12/23
  Time: 17:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Long commentId = Long.valueOf(request.getParameter("commentId"));
    Comment comment = ((Map<Long, Comment>) request.getAttribute("commentMap")).get(commentId);
    pageContext.setAttribute("comment", comment);
%>

<div class="comment-item">
    <img src="img/${comment.creator.photo}" alt="用户头像">
    <div class="username">${comment.creator.photo}</div>
    <div class="date">2023-01-01</div>
    <div class="content"><p>${comment.content}</p></div>
    <span class="pull-right">
                <button onclick="like(${comment.id})" class="btn btn-link"><span id="like-num-${comment.id}">${comment.likeCount> 0 ? comment.likeCount : '赞'}</span> <span id="like-icon-${comment.id}" class="glyphicon glyphicon-thumbs-up <c:if test="${not empty cookie['comment-like-'.concat(comment.id)]}">alert-danger</c:if>"></span></button>
                <button onclick="dislike(${comment.id})" class="btn btn-link"><span id="dislike-num-${comment.id}">${comment.dislikeCount > 0 ? comment.dislikeCount : '踩'}</span> <span id="dislike-icon-${comment.id}" class="glyphicon glyphicon-thumbs-down <c:if test="${not empty cookie['comment-dislike-'.concat(comment.id)]}">alert-danger</c:if>"></span></button>
    </span>
    <p>
        <c:if test="${comment.hidden}">
            <span class="text-muted"><i>评论内容已删除</i></span>
        </c:if>
        <c:if test="${!comment.hidden}">
            ${comment.content}
        </c:if>
    </p>
</div>
